The present invention relates to a method of decoding compressed moving-picture data, and a decoder employing this method, more particularly to a method and decoder that are suitable when the compressed data contain errors.
Many methods of compressing moving-picture data are known, including methods that employ variable-length codes. For example, Recommendation H.261 of the Telecommunication Standardization Sector of the International Telecommunication Union (ITU-T) specifies a variable-length coding method that divides a video data stream into groups of picture areas, employing a start code to identify the beginning of each group. Each picture area may be coded in either an intra mode or an inter mode. Further details will be given in the description of the invention.
In any method using a variable-length code, when there is an error in the coded data stream, the decoder may lose synchronization with the boundaries of the codewords. The loss synchronization is recognized when the decoder encounters an illegal codeword or some other violation of the coding rules. To minimize picture degradation, a conventional decoder discards all data from the point where the error is recognized up to the next point where synchronization is reliably regained in the H.261 coding scheme, this point is the next start code. The discarded data are replaced by, for example, substituting the decoded data from the preceding frame of the moving picture.
A problem with this is that the decoder may not recognize the loss of synchronization immediately. This occurs when an error turns the intended codeword into another legal codeword having a different length. Sometimes a string of several unintended but legal codewords is produced in this way. The decoder may thus decode a certain amount of data incorrectly without becoming aware of the error, and output the incorrect data under the false assumption that the data were decoded correctly. Use of the incorrectly decoded data can cause severe picture degradation, especially in picture areas coded in the intra mode.
Some variable-length codes have a property so that when boundary synchronization is lost because of an error, correct synchronization is quickly and automatically regained, with a high probability, without the need to wait for the appearance of a special code such as a start code. With these self-resynchronizing codes there is a further problem, however, in that sometimes incorrect synchronization is regained before correct synchronization is regained. Thus after recognizing an error and discarding a certain amount of non-decodable data, the decoder may recognize a legal codeword and be led to assume that resynchronization has occurred, when in fact the recognized codeword consists of pieces of two adjacent codewords. In this case, incorrect data may also be output as if the data were correct.
Problems such as the above are not limited to variable-length codes. In any coding scheme that compresses moving-picture data, when a segment of data is rendered unusable because of an error, there is a danger that usable decoded data preceding or following the unusable segment may have been decoded incorrectly, and that the use of such incorrectly decoded data might cause objectionable picture defects.
It is accordingly an object of the present invention to prevent the quality of a moving picture from being degraded by unrecognized decoding errors preceding or following a recognized error.
When a segment of a compressively coded data stream representing a moving picture is rendered unusable by an error, the invented decoding method discards a certain amount of decoded data adjacent to the unusable segment, and uses other decoded data to replace the discarded decoded data. The decoded data on one side or both sides of the unusable segment may be discarded.
When data for different picture areas are coded in different modes, the invented method preferably sets a separate discarding range for each mode. When each picture area occupies a single section of the coded data stream, the invented decoding method preferably discards a specified number of decoded picture areas. When each picture area occupies multiple non-contiguous sections in the coded data stream, the invented decoding method preferably discards all decoded data for all picture areas having any coded data in a designated range.
The invented moving-picture decoder comprises a decoding unit that decodes data and recognizes errors, a picture memory for storing the decoded data, and a discarding unit for setting the range or ranges in which decoded data are to be discarded.